package be.jaisy.osgi.transaction;

public interface ITransactionManager {
	
	/**
	 * Begin a unit of work and return the associated Transaction object. If a new underlying transaction is required, begin the
	 * transaction. Otherwise continue the new work in the context of the existing underlying transaction.
	 */
	void beginTransaction();

	/**
	 * Flush the associated Session and end the unit of work. This method will commit the underlying transaction if and only if the
	 * underlying transaction was initiated by this object
	 */
	void commitTransaction();

	/**
	 * Force this session to flush. Must be called at the end of a unit of work, before commiting the transaction and closing the
	 * session. Flushing is the process of synchronizing the
	 * underlying persistent store with persistable state held in memory.
	 */
	void flushTransaction();

	/**
	 * Force the underlying transaction to roll back.
	 */
	void rollbackTransaction();
}
